package com.internetCafes.spms.web.certificate.dao;

import com.baomidou.mybatisplus.annotation.SqlParser;
import com.internetCafes.spms.core.annotation.NoTentant;
import com.internetCafes.spms.core.annotation.TentantFilter;
import com.internetCafes.spms.web.certificate.entity.CertificateInfo;
import com.internetCafes.spms.core.generic.GenericDao;
import com.internetCafes.spms.web.certificate.vo.CertificateInfoVo;
import com.internetCafes.spms.web.certificate.vo.CollectInfo;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;
import java.util.Map;

/**
 * 证书信息表
 *
 * @author Sunny
 * @email rekeeper2011@hotmail.com
 * @date 2019-10-31 18:10:59
 */
@Mapper
public interface CertificateInfoMapper extends GenericDao<CertificateInfo, Long> {

    /**
     * 更具证书id列表批量更新证书信息
     *
     * @param param ids列表 需要修改的信息
     * @author Zj
     */
    void updateCertificateInfoBatch(Map<String, Object> param);

    /**
     * 根据证书编号列表获取证书信息
     *
     * @param param 证书编号
     * @return 证书信息
     * @author Zj
     */
    @TentantFilter(tableAlias = "e")
    List<CertificateInfo> certificateInfosByNos(Map<String, Object> param);

    /**
     * 证书的人员id指向最后员工id
     *
     * @param params 请求参数
     */
    void updateEmployeeIdBatch(Map<String, Object> params);

    /**
     * 根据身份证获取需要处理的证书信息
     *
     * @param params 限身份证ids
     * @return 结果
     */
    List<CertificateInfoVo> selectInfoByIdCardsForRepeat(Map<String, Object> params);

    /**
     * 获取需要短信提醒的90天内过期的所有证书信息列表
     *
     * @param params ids
     * @author Zj
     */
    List<CertificateInfoVo> selectExpireInfo(Map<String, Object> params);

    /**
     * 插入
     */
    int insert(CertificateInfo certificateInfo);

    /**
     * 批量插入
     */
    int insertBatch(List<CertificateInfo> certificateInfoList);

    /**
     * 选择插入
     */
    int insertSelective(CertificateInfo certificateInfo);

    /**
     * 按主键ID查询
     */
    @NoTentant
    CertificateInfo selectByPrimaryKey(Long id);

    /**
     * 按主键ID选择更新
     */
    int updateByPrimaryKeySelective(CertificateInfo certificateInfo);

    /**
     * 按主键ID更新
     */
    int updateByPrimaryKey(CertificateInfo certificateInfo);

    /**
     * 按参数查询
     */
    List<CertificateInfo> selectByParams(Map<String, Object> params);

    /**
     * 按参数查询数量
     */
    long countByParams(Map<String, Object> params);

    /**
     * 按主键ID删除
     */
    int deleteByPrimaryKey(Long id);

    /**
     * 按主键ID批量删除
     */
    int deleteBatchByPrimaryKey(List<Long> ids);

    @TentantFilter(tableAlias = "e")
    long countByJobParams(Map<String, Object> params);

    @TentantFilter(tableAlias = "e")
    List<CertificateInfoVo> selectByJobParams(Map<String, Object> params);

    @TentantFilter(tableAlias = "e")
    @SqlParser(filter = true)
    List<CertificateInfoVo> selectCertificateBalance(Map<String, Object> params);

    @SqlParser(filter = true)
    @TentantFilter(tableAlias = "b")
    List<CertificateInfoVo> selectBalanceDetails(Map<String, Object> params);

    @SqlParser(filter = true)
    @TentantFilter(tableAlias = "c")
    Long countBalanceDetails(Map<String, Object> params);

    @TentantFilter(tableAlias = "e")
    List<CollectInfo> collectAllByJobParams(Map<String, Object> params);

    @TentantFilter(tableAlias = "e")
    List<CollectInfo> partJobCertByJobParams(Map<String, Object> params);

    @TentantFilter(tableAlias = "e")
    List<CollectInfo> passCertByJobParams(Map<String, Object> params);

    @TentantFilter(tableAlias = "e")
    List<CollectInfo> willPassCertByJobParams(Map<String, Object> params);

    @TentantFilter(tableAlias = "e")
    List<CollectInfo> bringCertByJobParams(Map<String, Object> params);

    @TentantFilter(tableAlias = "e")
    List<CollectInfo> borrowCertByJobParams(Map<String, Object> params);

}
